﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiDgLinetype : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiDgLinetype(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiDgLinetype obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiDgLinetype()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiDgLinetype(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdGiDgLinetype() : this(GlobalsPINVOKE.new_OdGiDgLinetype(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isContinuous()
		{
			bool result = GlobalsPINVOKE.OdGiDgLinetype_isContinuous(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isByBlock()
		{
			bool result = GlobalsPINVOKE.OdGiDgLinetype_isByBlock(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setByBlock(bool value)
		{
			GlobalsPINVOKE.OdGiDgLinetype_setByBlock(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isByLayer()
		{
			bool result = GlobalsPINVOKE.OdGiDgLinetype_isByLayer(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setByLayer(bool value)
		{
			GlobalsPINVOKE.OdGiDgLinetype_setByLayer(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double patternLength()
		{
			double result = GlobalsPINVOKE.OdGiDgLinetype_patternLength(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setPatternLength(double dPatLen)
		{
			GlobalsPINVOKE.OdGiDgLinetype_setPatternLength(this.swigCPtr, dPatLen);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public uint numItems()
		{
			uint result = GlobalsPINVOKE.OdGiDgLinetype_numItems(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setNumItems(uint count)
		{
			GlobalsPINVOKE.OdGiDgLinetype_setNumItems(this.swigCPtr, count);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void itemAt(uint index, OdGiDgLinetypeItem item)
		{
			GlobalsPINVOKE.OdGiDgLinetype_itemAt__SWIG_0(this.swigCPtr, index, OdGiDgLinetypeItem.getCPtr(item));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGiDgLinetypeItem itemAt(uint index)
		{
			OdGiDgLinetypeItem result = new OdGiDgLinetypeItem(GlobalsPINVOKE.OdGiDgLinetype_itemAt__SWIG_1(this.swigCPtr, index), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setItemAt(uint index, OdGiDgLinetypeItem item)
		{
			GlobalsPINVOKE.OdGiDgLinetype_setItemAt(this.swigCPtr, index, OdGiDgLinetypeItem.getCPtr(item));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void items(OdGiDgLinetypeItemArray items)
		{
			GlobalsPINVOKE.OdGiDgLinetype_items(this.swigCPtr, OdGiDgLinetypeItemArray.getCPtr(items));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setItems(OdGiDgLinetypeItemArray items)
		{
			GlobalsPINVOKE.OdGiDgLinetype_setItems(this.swigCPtr, OdGiDgLinetypeItemArray.getCPtr(items));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
